classdef TestDilate
    %TestDilate

    properties (Constant)
        img = uint8([...
            0 0 0 0 0 0 0 0 0 0;...
            0 0 0 0 0 0 0 0 0 0;...
            0 0 0 0 0 0 0 0 0 0;...
            0 0 0 1 1 1 0 0 0 0;...
            0 0 0 1 1 1 0 0 0 0;...
            0 0 0 1 1 1 0 0 0 0;...
            0 0 0 0 0 0 0 0 0 0;...
            0 0 0 0 0 0 0 0 0 0;...
            0 0 0 0 0 0 0 0 0 0;...
            0 0 0 0 0 0 0 0 0 0;...
        ]);
    end

    methods (Static)
        function test_1
            result = cv.dilate(TestDilate.img);
            validateattributes(result, {class(TestDilate.img)}, ...
                {'size',size(TestDilate.img)});
        end

        function test_2
            result = cv.dilate(TestDilate.img, 'Element',ones(3), ...
                'Anchor',[0,1], 'Iterations',1, 'BorderType','Constant');
            validateattributes(result, {class(TestDilate.img)}, ...
                {'size',size(TestDilate.img)});
        end

        function test_error_argnum
            try
                cv.dilate();
                throw('UnitTest:Fail');
            catch e
                assert(strcmp(e.identifier,'mexopencv:error'));
            end
        end
    end

end
